<template>
  <cwCommon ref="cwCommon"
            :type="type"
            :financeData="form"
            @changeFkuanList="changeFkuanList"
            :limit="limit"
            :ysid="ysid"
            @clear="clearForm"
            :name="cw"
  >
    <el-form-item label="付款名称">
     <el-select v-model="form.name" value-key="id" @change="changeLimit">
       <el-option :label="item.title" :value="item" v-for="(item,i) in fuKuanList" :key="i"></el-option>
     </el-select>
    </el-form-item>

    <el-form-item label="付款金额">
      <el-input v-model="form.money" placeholder="付款金额" @focus="$cls" @blur="$fmoney" ></el-input>
    </el-form-item>
  </cwCommon>
</template>

<script>
    import cwCommon from "./cwCommon";
    export default {
        name: "cwFkuan",
        data(){
            return {
                type: 4,
                form: {
                    name: '',
                    money: '0.00',
                    limit:0
                },
                fuKuanList: [],
                ysid: 0,
                limit: 0,
                cw:"付款"
            }
        },
        components: {cwCommon},
        methods:{
            changeFkuanList(list){
                this.fuKuanList = list;
                let item = list[0]
                this.form.name = item
                this.changeLimit(item)
            },
            changeLimit(item){
              this.form.limit = item.money
              this.ysid = item.id
              this.limit = item.money
              this.$refs.cwCommon.changeBaseInfoLimit(item.money)
              this.$refs.cwCommon.changeFKuanApplyLog(item)
            },
          clearForm(){
              this.form.name = '';
              this.form.money = '0.00';
              this.form.limit = '0.00';
              this.fuKuanList = [];
              this.ysid = 0
              this.limit = '0.00'
          }
        },
    }
</script>

<style scoped>

</style>
